[Table of Contents] [docx version]

WordprocessingML Reference Material - Table of Contents

Paragraph Styles

Paragraph styles are styles which apply to the contents of an entire paragraph as well as the paragraph mark. This definition implies that the style can define both character properties (properties which apply to text within the document) as well as paragraph properties (properties which apply to the positioning and appearance of the paragraph). Paragraph styles cannot be referenced by runs within a document; they must be referenced by the pStyle element (§2.3.1.27) within a paragraph’s paragraph properties element.

A paragraph style has three defining type-specific characteristics:

The type attribute on the style has a value of paragraph, which indicates that the following style definition is a paragraph style.

The next element defines an editing behavior which supplies the paragraph style to be automatically applied to the next paragraph when ENTER is pressed at the end of a paragraph of this style.

The style specifies both paragraph-level and character-level properties using the pPr and rPr elements, respectively. In this case, the run properties are the set of properties applied to each run in the paragraph.

The paragraph style is then applied to paragraphs by referencing the styleId attribute value for this style in the paragraph properties’ pStyle element.

[Example: Consider a paragraph style titled "Test Paragraph Style" which defines; font = Algerian, font size = 20; font color = red; paragraph spacing = double; paragraph indent = 1” (first line only). The resulting style definition would be:

<w:style w:type="paragraph" w:styleId="TestParagraphStyle">
<w:name w:val="Test Paragraph Style"/>
<w:qformat/>
<w:rsid w:val="00F85845"/>
<w:pPr>
<w:spacing w:line="480" w:lineRule="auto"/>
<w:ind w:firstLine="1440"/>
</w:pPr>
<w:rPr>
<w:rFonts w:ascii="Algerian" w:hAnsi="Algerian"/>
<w:color w:val="ED1C24"/>
<w:sz w:val="40"/>
</w:rPr>
</w:style>

Notice that the character properties for the style are under the rPr element, and the paragraph properties are under the pPr element.

The document content for a paragraph of this style would be:

<w:p>
<w:pPr>
<w:pStyle w:val="TestParagraphStyle"/>
</w:pPr>
<w:r>
<w:t xml:space="preserve">Here is some fancy Text</w:t>
</w:r>
</w:p>

The pStyle element links the paragraph with the style definition. end example]